<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    p {
        text-align: center;
    }
</style>

<body>
    <p>
        <input type="text" class="i1"> <b>VS</b> <input type="text" class="i2"> <button>最大的数字是>></button><span
            style="color: red;">0</span>
    </p>
</body>

</html>
<script>
    var btn = document.querySelector('button')
    var i1 = document.querySelector('.i1')
    var i2 = document.querySelector('.i2')
    var sp = document.querySelector('span ')
    btn.onclick = function () {
        if (i1.value > i2.value) {
            sp.innerHTML = i1.value
        } else {
            sp.innerHTML = i2.value
        }
    }
</script>